import os


def composite_file():
    file_dir = r'C:\Users\33530\Desktop\test'

    for root, dirs, files in os.walk(file_dir):
        print("root", root)  # 当前目录路径
        print("dirs", dirs)  # 当前路径下所有子目录
        print("files", files)  # 当前路径下所有非目录子文件


# composite_file()

def splice_file():
    img_link = 'http://r.ikanhm.xyz/static/upload/book/748/32368/1219717.jpg'

    print(img_link.split('/')[-2])
    print(img_link.split('/')[-1])

    complete_img_info = img_link.split('/')[-1]
    print(complete_img_info.split('.')[0])

    common_path = "D:\\file\\my"

    print(os.path.join(common_path, "text.txt"))

splice_file()